import { Controller, Get } from '@nestjs/common';
import { BranchService } from './branch.service';
import { User, UserDto } from '../user/user.decorator';
import { ResultData } from 'src/common/utils/result';
import { RequirePermission } from 'src/common/decorator/require-perm.decorator';

@Controller('branch')
export class BranchController {
  constructor(private readonly branchService: BranchService) {}

  @Get('list')
  @RequirePermission('system:enterprise:branch:list')
  async list(@User() user: UserDto) {
    const result = await this.branchService.findAll(user);
    return ResultData.ok(result);
  }
}
